# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy


class CprojectzhilianItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    pass

class ZhilianItem(scrapy.Item):
    # 详情地址
    url = scrapy.Field()
    positon = scrapy.Field()
    salary= scrapy.Field()
    # salary_max = scrapy.Field()
    location = scrapy.Field()
    years = scrapy.Field()
    degree = scrapy.Field()
    date_pub = scrapy.Field()
    jobdesc = scrapy.Field()
    jobaddr = scrapy.Field()
    company = scrapy.Field()
    crawl_time = scrapy.Field()
    spider = scrapy.Field()

    def get_sql(self):
        sql = 'insert into zhilian(url,positon,salary,location,years,degree,date_pub,jobdesc,jobaddr,company,crawl_time,spider) values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'
        data = (self['url'],self['positon'],self['salary'],self['location'],self['years'],self['degree'],self['date_pub'],self['jobdesc'],self['jobaddr'],self['company'],self['crawl_time'],self['spider'])
        return sql,data